Unordered idempotent logical replication operations

ABSTRACT

A method and apparatus for replicating a data container of a source storage server at the logical level in an unordered stream of individual data units are described. In certain embodiments, the replication operations can be performed without regard to the differences in geometry of physical persistent storage of the source and destination storage servers and without regard to the differences in data container format of the source and destination storage servers. An initial replication operation of the source data container is performed by transferring the data objects within the source data container to a replica data container in the destination storage server as an unordered stream of individual data units while preserving data object identifiers of the source data objects. Afterwards, incremental replication operations can be performed to capture modifications to the source data container over time after the initial replication operation.

PRIORITY

This application is a continuation of U.S. application Ser. No. 12/713,744 entitled, “Unordered Idempotent Replication Operations,” filed on Feb. 26, 2010, which is a continuation-in-part of U.S. application Ser. No. 12/433,871 entitled, “Unordered :Idempotent Replication Operations,” filed on Apr. 30, 2009, and claims priority to U.S. Provisional Patent Application Ser. No. 61/242,366 filed Sep. 14, 2009, each of which is hereby incorporated herein by reference in its entirety.

FIELD OF THE INVENTION

At least one embodiment of the present invention pertains to data storage systems, and more particularly, to a technique for performing out-of-order logical replication of data.

BACKGROUND

A network storage system is a processing system that is used to store and retrieve data on behalf of one or more hosts on a network. A storage system operates on behalf of one or more hosts to store and manage data in a set of mass storage devices, such as magnetic or optical storage-based disks or tapes. Some storage systems are designed to service file-level requests from hosts, as is commonly the case with file servers used in a network attached storage (NAS) environment. Other storage systems are designed to service block-level requests from hosts, as with storage systems used in a storage area network (SAN) environment. Still other storage systems are capable of servicing both file-level requests and block-level requests, as is the case with certain storage servers made by NetApp, Inc. of Sunnyvale, Calif.

One common use of storage systems is data replication. Data replication is a technique for backing up data, where a given data set at a source is replicated at a destination, which is often geographically remote from the source. The replica data set created at the destination is called a “mirror” of the original data set. Typically replication involves the use of at least two storage systems, e.g., one at the source and another at the destination, which communicate with each other through a computer network or other type of data interconnect.

Replication of data can be done at a physical block level or at a logical block level. To understand the difference, consider that each data block in a given set of data, such as a tile, can be represented by both a physical block, pointed to by a corresponding physical block pointer, and a logical block pointed to by a corresponding logical block pointer. These two blocks are actual the same data block. However, the physical block pointer indicates the actual physical location of the data block on a storage medium, whereas the logical block pointer indicates the logical position of the data block within the data set (e.g., a fi(e) relative to other data blocks. When replication is performed at the physical block level, the replication process creates a replica at the destination storage system that has the identical structure of physical block pointers as the original data set at the source storage system. When replication is done at the logical block level, the replica at the destination storage system has the identical structure of logical block pointers as the original data set at the source storage system, but may (and typically does) have a different structure of physical block pointers than the original data set at the source storage system.

Conventional replication systems have various limitations. Replication at the physical block level has the limitation that it requires that the destination storage system have the identical disk topology (or disk geometry) as the source storage system. For example, some (not all) differences in the Redundant Array of Inexpensive Disk (RAID) configurations between a source storage system and a destination storage system would prevent replication between them at the physical block level. Replication at the logical block level overcomes this limitation, but still requires that the destination storage system have the identical format for directories and other meta-data as the source storage system. On the other hand, conventional systems performing replication at the logical entry level have limitations. Typically, the file system of the source storage system is analyzed to determine changes that have occurred to the file system, and then those changes are transferred to the destination storage system in a particular order. This typically includes “walking” the directory trees at the source storage system to determine the changes to various file system objects within each directory tree, as well as identifying the changed file system object's location within the directory tree structure. The changes are then sent to the destination storage system in a certain order (e.g., directories before subdirectories, and subdirectories before files, etc.) so that the directory tree structure of the source storage system is preserved at the destination storage system. Updates to directories of the source file system are received and processed at the destination storage system before updates to the files in each of the directories can be received and processed. If updates to data in files are received before the updates to the directories that the files are stored in, then files are essentially orphaned because the destination server lacks adequate information as to in which directory the updates to files are to be stored. That is, updates to the data in the file cannot be processed before the directory referencing the file exists on the destination storage system.

The source storage system first performs a search through all the directories in the source storage system to figure out which directories have been updated, and then performs a second search within each directory to figure out which files have been updated in those directories. Moreover, additional searches are performed for file systems that have nested or hierarchical directory structures, such that higher-level directories are searched before tower-level directories (e.g., subdirectories), and so on. This analysis requires the source storage system to walk its way down from the top to the bottom of each of the directory trees of the source storage system before any updates to the file system in source storage system can be transferred to the destination storage system. Then, the updates are transferred to the destination storage system in order so that the destination storage system can properly process the updates to generate the replica file system in the destination storage system. This can take a significant amount of time for large file systems and can impact performance in replication operations at the logical entry level.

Known technology in the area of file system replication includes the Andrew File System (AFS), which provided for the creation of replicas of a volume of data based on a point-in-time copy of the source volume called a “clone,” and also provided for incrementally updating the target replica volume by identifying changes between two clones of a particular volume, and applying those changes to a corresponding clone of the target replica. Clones were created by copying entire mode files describing the file to the replica and incrementing a reference count of a block addressing tree associated with each file. The reference count indicated that the block addressing tree was referenced from an additional file system. In the AFS system, a file system was translated, incrementally or in full. A file system was transferred incrementally by selecting files modified since the previous replication operation and a file system was transferred in full by selecting all files in a volume in the order in which they appeared in the inode files. Entire files and directories were transferred between servers, because the clone granularity was at the level of entire files and no block sharing occurred within a files block addressing tree. The directory contents were transmitted in a logical format containing integers in a standard-byte ordering. In addition, AFS replication could create and manage a target replica with a different type of file system than the source file system.

Another known technology in this area is the DCE/DFS file system, called “Episode,” which extended the work done in AFS by adding support for block-level replication. The Episode file system created what are called “snapshots,” which are well-known in storage systems and used for, among other things, storage management and facilitating replication operations. A snapshot is a persistent image (usually read-only) of a file system or other data container at a point in time. The Episode file system created snapshots by copying an entire mode file for a volume of data to the target replica and setting a hit on each top-level pointer of each mode in the mode file indicating that all of the data under this block pointer (associated with either direct or indirect blocks) should be copied before being modified by further write data (that is, should be treated as “copy on write” data).

All updates to indirect blocks and data blocks were made by writing the new data to previously free newly allocated disk blocks. When generating differences between two snapshots, Episode replication determined differences by iterating over the modes in the two file systems using an efficient ordering rather than requiring the processing of directories before processing their child files, and/or sub-directories, etc. For each file that had the same generation number in both snapshots (indicating that the file was not deleted between the two snapshots being taken), then for each pointer in the file block addressing trees of both the files in the two snapshots respectively, if the pointers to a data block differed, then that data block was required to be included in the replication propagation. If two pointers were identical, whether direct or indirect, then the replication engine knew that no data anywhere in that block addressing sub-tree had changed between the two replicas, and that no data from that sub-tree needed to be copied.

Note that each directory block was sufficiently self-contained such that a logical description of the changed subset of a directory could be generated from one or more individual changed directory blocks, and that logical description was passed to the target server where directory entries based on this information were created or deleted. This changed subset required including information on all of the directory entries that changed. In at least certain cases, the changed subset also included descriptions of other directory entries that were unchanged between the two snapshots, except that they happened to reside in the same disk block as other changed directory entries.

Finally, the Spinnaker Network's SpinFS file system replication snapshot and replication algorithms worked very similarly to those of the DCE/DFS Episode algorithms. A significant difference; however, was that the SpinFS replication engine simply treated directories as files from the point of view of replica propagation, updating entire blocks of the target directory from the contents of the source directory.

SUMMARY

Embodiments of the technique introduced here include a method and apparatus for replicating a data container of a source storage system at the logical level in an unordered stream of individual data units without regard to the differences in geometry of physical persistent storage of the source and destination storage systems and without regard to the differences in data container format of the source and destination storage systems. An initial replication operation of a data container in the source storage system is performed by scanning each data object within the data container and transferring the data objects from the source data container to a data container of the destination storage system in the unordered stream of individual data units while preserving the source data object identifiers.

After the initial replication operation, incremental replication operations are performed to capture modifications to the source data container over time. These incremental replication operations include creating a current snapshot of the source data container, identifying changes in the source data container since a previous replication operation by comparing the current snapshot with the snapshot of the previous replication operation, and transferring the identified changes to the destination storage system in an unordered stream of individual data units while preserving the data object identifiers,

BRIEF DESCRIPTION OF THE DRAWINGS

One or more embodiments of the present invention are illustrated by way of example and not limitation in the figures of the accompanying drawings, in which like references indicate similar elements and in which:

FIG. 1 depicts a configuration of network storage systems in which the techniques being introduced here can be implemented according to an illustrative embodiment;

FIG. 2 is a high level block diagram of an illustrative embodiment of a storage system architecture;

FIG. 3 is a block diagram of a storage operating system according to an illustrative embodiment;

FIG. 4 depicts a buffer tree of a file according to an illustrative embodiment;

FIG. 5 depicts a buffer tree including an inode file according to an illustrative embodiment;

FIG. 6A depicts an initial replication process of a file system in a source storage system at the logical level according to an illustrative embodiment;

FIG. 6B depicts a process for replicating a file system of a source storage system at a destination storage system at the logical level according to an illustrative embodiment;

FIG. 6C depicts an incremental replication process of a file system in a source storage system at the logical level according to an illustrative embodiment;

FIG. 7A depicts replicating a data file block at the logical block level according to an illustrative embodiment;

FIG. 7B depicts replicating a directory at the logical entry level according o an illustrative embodiment;

FIG. 8A depicts adding a new directory entry during a replication operation according to an illustrative embodiment;

FIG. 8B depicts deleting a directory entry during a replication operation according to an illustrative embodiment; and

FIG. 8C depicts modifying a directory entry during a replication operation according to an illustrative embodiment.

DETAILED DESCRIPTION

A method and apparatus for performing out-of-order replication of a data container in a source storage system at the logical level are described. Note that references in this specification to “an embodiment”, “one embodiment”, or the like, mean that the particular feature, structure or characteristic being described is included in at least one embodiment of the present invention. Occurrences of such phrases in this specification do not necessarily refer to the same embodiment; on the other hand, they are not necessarily mutually exclusive either,

To logically replicate a data container in a source storage system that contains a hierarchical data structure, the unordered replication operation disclosed herein can replicate the data container without regard to the hierarchical structure of the source data container. The replication process can treat data objects of the source storage system as isolated entities, and transmit them to the destination storage system in no particular order. In one embodiment, the data container is a file system and the data objects are file system objects. The file system objects, such as tiles and directories, are identified by identifiers, which are created when a particular file system object is first created in the data container of the source storage system. The file system object identifier is unique in the source data container to ensure that the object referred by the identifier can be quickly accessed. In order to provide unordered replication of the data container, the original identifiers for the data Objects are preserved throughout the replication operations.

A data set may include, besides data, information to help in organizing and accessing the data; this information is collectively called meta-data. One common type of meta-data is a directory, consisting of a number of entries, each of which specifies a name and the location (within the data set) of the data file with that name. The replication of directories and other meta-data may be done by methods different from those used for the replication of data. If data replication is done at a physical block level, then replication of directories and other meta-data must also be done at the physical block level But if data replication is done at a logical block level, then directory replication may be done either at the logical block level, or at a still higher level called the logical directory entry level or logical entry level. When directory replication is done at the logical entry level, the replica at the destination storage system has the identical set of names and corresponding file locations, but directory entries may be (and typically are) placed at different locations within the directory from the locations used at the source storage system; and in addition, the format used for a directory entry (and perhaps other meta-data) at the destination storage system may be different from the format used at the source storage system.

The data objects in the destination storage system can be identified and accessed using the original data object identifiers that are created and maintained at the source storage system. By preserving the original data object identifiers, the order of creating and data objects in the destination storage system becomes irrelevant. For example, a particular file of the source storage system can be replicated to the destination storage system before its parent directory even though the replicated file cannot be conventionally accessed by an external application. Once the parent directory is replicated, the previously replicated file becomes accessible again. Similarly, a directory can be transferred with preserved inner references to files, which have not yet been transferred to the destination. When this directory is recreated at the destination storage system, the inner references are created even though the referenced files will be copied over later. Thus, by preserving the data object identifiers, unordered replication operations can process any file system object in the source storage system in any order while being certain that once all the data objects are copied over, the resulting data container in the destination storage system will be consistent.

In one embodiment, the data container is a file system. For the purposes of this description, a file system is a structured (e.g., hierarchical) set of stored files, directories and/or other data containers. In a system where the data container is a file system, the unordered replication operations can transfer source file system objects to a destination storage system utilizing a different file system format. For example, a source storage system can be configured as a MICROSOFT WINDOWS file system, with each of the files and directories being identifiable with a “file ID,” while the destination storage system can be configured as a ILINUX file system, which references files and directories using an “inode.” mode is a metadata container which is used to store metadata about a file, directory or other file system object, such as ownership of the file, access permissions for the file, size of the fi(e, type, and pointers used to locate the data blocks for the file. The inode is the root of (Le., contains pointers t)) the highest level of indirect blocs for a file and is stored in a separate inode file. During the unordered replication operations, a specific transferring mechanism can be implemented to convert all the “file IDs” of the source storage system to the “inodes” of the destination storage system (and vice versa) with a one-to-one correspondence to ensure that the files and directories in the replicated file system remain consistent. Further, the unordered replication process can be enhanced with parallel-processing capabilities,

An advantage of this description herein over the prior art techniques described above is in the ability to replicate data from the source storage system to a destination storage system (mirror) without having to firs copy over the entire i node file. Rather, the mode file is created on-the-fly as the data objects are transmitted in any order from the source to the destination storage system. Once the destination storage system receives the data objects, the inode file may be pieced together using the data object identifiers discussed above. A(so, for incremental replication operations, this technique allows for the transfer of only those directory entries that have been modified between two snapshots of the source storage server to the target (destination) storage server; thus minimizing the bandwidth and processing required to propagate changes between the two storage servers. Rather, the data objects of the source storage server to be replicated are copied over to the destination server in a piece-by-piece manner, and then pieced together at the destination. The source inode file is then reconstructed at the destination based on preserving the data object identifiers associated with data objects.

In certain embodiments, the unique reference for each data block includes a physical volume block number (PVBN) of the data block and a virtual volume block number (VVBN) of the data block, which (in either case) is independent of the logical block number(s) of the data block. PVBNs and VVBNs are described further below. In such embodiments, the data structure maintained by the destination storage system includes a mapping of source storage system PAIBNs (or VVBNs) to corresponding destination storage system PVBNs (or VVBNs FIG. 1 depicts a configuration of network storage systems in which the techniques being introduced here can be implemented according to an illustrative embodiment. In a source storage system 2A is coupled to a source storage subsystem 4A and to a set of hosts 1 through an interconnect 3. The interconnect 3 may be, for example, a local area network (LAN), wide area network (WAN), metropolitan area network (MAN), global area network such as the Internet, a Fibre Channel fabric, or any combination of such interconnects. Each of the hosts I may be, for example, a conventional personal computer (PC), server-class computer, workstation, handheld computing/communication device, or other computing/communications device.

In one embodiment, source storage system 2A includes a storage operating system 7A, storage manager 123A, snapshot differential module 122, and replication engine 8A. Each of storage operating system 7A, storage manager 123A, snapshot differential module 122, and replication engine 8A are computer hardware components of the storage system including special purpose hardware circuitry (e.g., “hardwired”) or general purpose hardware circuitry that is programmed with software and/or firmware, or any combination thereof Storage of data in the source storage subsystem 4A is managed by storage manager 123A of source storage system 2A. Source storage system 2A and source storage subsystem 4A are collectively referred to as a source storage system. The storage manager 123A receives and responds to various read and write requests from the hosts 1, directed to data stored in or to be stored in storage subsystem 4A. Storage subsystem 4A includes a number of nonvolatile mass storage devices 5, which can be, for example, conventional magnetic or optical disks or tape drives; alternatively, they can be non-volatile solid-state memory, such as flash memory, or any contination of such devices. The mass storage devices 5 in storage subsystem 4A can be organized as a RAID group, in which case the storage controller 2 can access the storage subsystem 4 using a conventional RAID algorithm for redundancy.

Storage manager 123A processes write requests from hosts 1 and stores jututn unused storage locations in mass storage devices 5 of the storage subsystem 4A. In one embodiment, the storage manager 123A is implemented as a “write anywhere” file system such as the proprietary Write Anywhere File Layout file (WAFL™) system developed by Network Appliance, Inc., Sunnyvale, Calif., WAFL systems are not constrained to write any particular data or metadata to a particular storage location or region, Rather, WAFL systems can write to any unallocated block on any available mass storage device and do not overwrite data on the devices. If a data block on disk is updated or modified with new data, the data block is thereafter stored (written) to a new location on disk instead of modifying the block in place to optimize write performance.

The storage manager 123A of source storage system 2A is responsible for managing storage of data in the source storage subsystem 4A, servicing requests from hosts 1, and performing various other types of storage related operations. In one embodiment, the storage manager 123A, the source replication engine 8A and the snapshot differential module 122 are logically on top of the storage operating system 7A. The source replication engine 8A operates in cooperation with a remote destination replication engine 8B, described below, to perform logical replication of data stored in the source storage subsystem 4A. Note that in other embodiments, one or both of the storage manager 123A, replication engine 8A and the snapshot differential module 122 may be implemented as elements within the storage operating system 7A.

The source storage system 2A is connected to a destination storage system 2B through an interconnect 6, for purposes of replicating data. Although illustrated as a direct connection, the interconnect 6 may include one or more intervening devices and/or may include one or more networks. In the illustrated embodiment, the destination storage system 2B includes a storage operating system 7B, replication engine 8B and a storage manager 123B. The storage manager 123B controls storage related operations on the destination storage system 2B. In one embodiment, the storage manager 123B and the destination replication engine 8B are logically on top of the storage operating system 7B. In other embodiments, the storage manager 123B and the destination replication engine 8B may be implemented as elements within storage operating system 7B. The destination storage system 2B and the destination storage subsystem 4B are collectively referred to as the destination storage system. The destination replication engine 8B works in cooperation with the source replication engine 8A to replicate data from the source storage system to the destination storage system.

Storage systems 2A and 2B each may be, for example, a storage system which provides file-level data access services to hosts 1, such as commonly done in a NAS environment, or block-level data access services such as commonly done in a SAN environment, or it may be capable of providing both file-level and block-level data access services to hosts 1. Further, although the storage systems 2 are illustrated as single units in FIG. 1, they can have a distributed architecture. For example, the storage systems 2 can be designed as physically separate network modules (e.g., “N-module”) and data modules (e.g., “D-module”) (not shown), which communicate with each other over a physical interconnect. Such an architecture allows convenient scaling, such as by deploying two or more N-modules and D-modules, all capable of communicating with each other over the interconnect.

FIG. 2 is a high-level block diagram of an illustrative embodiment of a storage system architecture. The storage system 2 includes one or more processors 122 and memory 124 coupled to an interconnect bus 125. The interconnect bus 125 shown in FIG. 2 is an abstraction that represents any one or more separate physical interconnect buses, point-to-point connections, or both, connected by appropriate bridges, adapters, and/or controllers. The interconnect bus 125, therefore, may include, for example, a system bus, a Peripheral Component Interconnect (PCI) bus or PCI-Express bus, a HyperTransport or industry standard architecture (ISA) bus, a small computer system interface (SCSI) bus, a universal serial bus (USB), IIC (I2C) bus, or an Institute of Electrical and Electronics Engineers (IEEE) standard 1394 bus, also called “Firewire”.

The processor(s) 122 is/are the central processing unit(s) (CPU) of the storage systems 2 and, therefore, control the overall operation of the storage systems 2. In certain embodiments, the processor(s) 122 accomplish this by executing software or firmware stored in memory 124. The processor(s) 122 may be, or may include, one or more programmable general-purpose or special-purpose microprocessors, digital signal processors (DSPs), programmable controllers, application specific integrated circuits (ASICs), programmable logic devices (PLDs), trusted platform modules (TPMs), or the like, or a combination of such devices. The memory 124 is or includes the main memory of the storage systems 2. The memory 124 represents any form of random access memory (RAM), read-only memory (ROM), flash memory, or the like, or any combination of such devices. Also connected to the processor(s) 122 through the interconnect bus 125 is a network adapter 126 and a storage adapter 128. The network adapter 126 provides the storage systems 2 with the ability to communicate with remote devices, such as hosts 1, over the interconnect 3 of FIG. 1, and may be, for example, an Ethernet adapter or Fibre Channel adapter. The storage adapter 126 allows the storage systems 2 to access storage subsystems 4A or 4B, and may be, for example, a Fibre Channel adapter or SCSI adapter.

FIG. 3 is a block diagram of a storage operating system according to an illustrative embodiment. As used herein, the term “storage operating system” generally refers to the computer-executable code operable on a computer to perform a storage function that manages data access. Storage operating system 7 can also be implemented as a microkernel, an application program operating over a general-purpose operating system such as UNIX® or Windows NT®, or as a general-purpose operating system configured for the storage applications as described herein. In the illustrated embodiment, the storage operating system includes a network protocol stack 310 having a series of software layers including a network driver layer 350 (e.g., an Ethernet driver), a network protocol layer 360 (e.g., an Internet Protocol layer and its supporting transport mechanisms: the TCP layer and the User Datagram Protocol layer), and a file system protocol server layer 370 (e.g., a CIFS server, a NFS server, etc.). In addition, the storage operating system 7 includes a storage access layer 320 that implements a storage media protocol such as a RAID protocol, and a media driver layer 330 that implements a storage media access protocol such as, for example, a Small Computer Systems Interface (SCSI) protocol. Any and all of the modules of FIG. 3 can be implemented as a separate hardware component. For example, the storage access layer 320 may alternatively be implemented as a parity protection RAID module and embodied as a separate hardware component such as a RAID controller. Bridging the storage media software layers with the network and file system protocol layers is the storage manager 123 that implements one or more file system(s) 340.

For the purposes of this description, a data container can be any logical or physical entity for the storage of data. For example, a data container can be a group of data blocks, a hard disk, a storage volume, a file system, a storage system, etc, A data container can also represent a set of files, a directory, or any other logical or physical structure that can be implemented by one or more storage systems or storage servers in a network storage environment. In one embodiment, the storage manager 123 implements data layout algorithms that improve read and write performance to the mass storage media 5, such as WAFL systems discussed above.

It is useful now to consider how data can be structured and organized by storage systems 2A and 2B in certain embodiments. Reference is now made to FIGS. 4 and 5 in this regard. In at least one embodiment, data is stored in the form of volumes, where each volume contains one or more directories, subdirectories, and/or files. The term “aggregate” is used to refer to a pool of physical storage, which combines one or more physical mass storage devices (e.g., disks) or parts thereof, into a single storage object. An aggregate also contains or provides storage for one or more other data sets at a higher-level of abstraction, such as volumes. A “volume” is a set of stored data associated with a collection of mass storage devices, such as disks, which obtains its storage from (i.e., is contained within) an aggregate, and which is managed as an independent administrative unit, such as a complete file system. Each volume can contain data in the form of one or more directories, subdirectories, and/or files.

In at least certain embodiments, each aggregate uses a PVBN space that defines the physical storage space of blocks provided by the storage devices of the physical volume, and likewise, each volume uses a VVBN space to organize those blocks into one or more higher-level objects, such as directories, subdirectories, and files. A PVBN, therefore, is an address of a physical block in the aggregate and a VVBN is an address of a block in a volume (the same block as referenced by the corresponding PVBN), i.e., the offset of the block within the volume. Knowledge of all of the VVBNs and PVBNs is maintained by the storage manager 300 in each storage system 2. Each VVVBN space is an independent set of values that corresponds to locations within a directory or file, which are translated to device block numbers (DBNs) on the physical storage device. Each volume can be “mingled” with other volumes onto a common set of physical storage in the aggregate by the storage manager 300.

In addition, data within the storage system is managed at a logical block level. At the logical block level, the storage manager maintains a logical block number (LBN) for each data block. If the storage system stores data in the form of files, the LBNs are called file block numbers (FBNs). Each FBN indicates the logical position of the block within a file, relative to other blocks in the file, i.e., the offset of the block within the file. For example, FBN 0 represents the first logical block in a particular file, while FBN 1 represents the second logical block in the file, and so forth. Note that the PVBN and VVBN of a data block are independent of the FBN(s) that refer to that block. In one embodiment, the FBN of a block of data at the logical block level is assigned to a PVBN-VVBN pair.

In one embodiment, each file is represented in the storage system in the form of a hierarchical structure called a “buffer tree.” As used herein, the term buffer tree is defined as a hierarchical metadata structure containing references (or pointers) to logical blocks of data in the file system. A buffer tree is a hierarchical structure which is used to store file data as well as metadata about a file, including pointers for use in locating the data blocks for the file. A buffer tree includes one or more levels of indirect blocks (called “L1 blocks”, “L2 blocks”, etc.), each of which contains one or more pointers to lower-level indirect blocks and/or to the direct blocks (called “L0 blocks”) of the file. All of the data in the file is stored only at the lowest level (L0) blocks. The root of a buffer tree is the “inode” of the file. As discussed above, an inode is a metadata container that is used to store metadata about the file, such as ownership, access permissions, file size, file type, and pointers to the highest-level of indirect blocks for the file. Each file has its own inode. The inode is stored in a separate mode file, which may itself be structured as a buffer tree. In hierarchical (or nested) directory file systems, this essentially results in buffer trees within buffer trees, where subdirectories are nested within higher-level directories and entries of the directories point to files, which also have their own buffer trees of indirect and direct blocks. Directory entries include the name of a file in the file system, and directories are said to point to (reference) that file. Alternatively, a directory entry can point to another directory in the file system. In such a case, the directory with the entry is said to be the “parent directory,” while the directory that is referenced by the directory entry is said to be the “child directory” or “subdirectory.”

FIG. 4 depicts a buffer tree of a file according to an illustrative embodiment. In the illustrated embodiment, a file is assigned an mode 422, which references Level 1 (L1) indirect blocks 424A and 424B. Each indirect block 424 stores at least one PVBN and a corresponding VVBN for each PVBN. There is a one-to-one mapping between each VVBN and PVBN. Note that a PVBN is a block number in an aggregate (i.e., offset from the beginning of the storage locations in an aggregate) and a VVBN is a block number in a volume (offset from the beginning of the storage locations in a volume); however, there is only one copy of the L0 data block physically stored in the physical mass storage of the storage system Also, to simplify description, only one PVBN-VVBN pair is shown in each indirect block 424 in FIG. 4; however, an actual implementation would likely include multiple many PVBN-VVBN pairs in each indirect block 424. Each PVBN references a physical block 427A and 427B, respectively, in the storage device (i.e., in the aggregate L0 blocks 433) and the corresponding VVBN references a virtual volume block 428A and 428B, respectively, in the storage device (i.e., in the volume L0 blocks 431). In addition, volumes can also be represented by files called “container files.” In such a case, the VNTBN references a block number offset from the beginning of the container file representing the volume. Physical blocks 427 and volume blocks 428 are actually the same L0 data for any particular PVBN-VVBN pair; however, they are accessed in different ways: the PVBN is accessed directly in the aggregate, white the VVBN is accessed virtually via the container file representing the volume

FIG. 5 depicts a buffer tree including an inode file according to an illustrative embodiment. In FIG. 5, for each volume managed by the storage system 2, the inodes of the files and directories in that volume are stored in an inode file 541. A separate inode file 541 is maintained for each volume. An inode file 422, in one embodiment, is a data structure representing a master list of file system objects (e.g., directories, subdirectories and files) of the file system in the storage system and each inode entry identifies a particular file system object within the file system. Each mode 422 in the inode file 541 is the root of a buffer tree 500 of the file corresponding to the inode 422. The location of the inode 541 for each volume is stored in a volume information (“Volumeinfo”) block 542 associated with that volume. The Volumeinfo block 542 is a metadata container that contains metadata that applies to the volume as a whole. Examples of such metadata include, for example, the volume's name, type, size, any space guarantees to apply to the volume, and the VVEN of the inode file of the volume.

For various reasons, it may be desirable to maintain a replica of the data set of the source storage system. For example, in the event of a power failure or other system crash, data lost at the source storage system can be recovered from the replica stored in the destination storage system. In order to do so, an initial replication operation of a data container maintained on the source storage system is first performed, where the data container of the source storage system contains a plurality of objects, each of which is assigned with a corresponding identifier. The initial replication of the data container of the source storage system includes scanning each data object within the data container and transferring the plurality of data objects from the source data container to a replica data container at a destination storage system in an unordered stream of individual data units while preserving the data object identifiers to replicate the data container of the source storage system in the destination storage system at the logical block level. This process of transferring the data objects takes place without regard to differences in geometry of physical persistent storage of the source and destination storage systems, and without regard to differences in data container format of the source and destination storage systems. In one embodiment, initial replication operations are performed using snapshots. As discussed previously, a snapshot is a persistent image (usually read-only) of the file system or other data container at a point in time. In one embodiment, a snapshot is generated by the source snapshot differential module 122 of FIG. 1. For further information regarding creating and maintaining snapshots within storage systems, see U.S. Pat. Nos. 5,819,292, 6,993,539, and 7,562,077, Each of these patents is commonly assigned to the assignee of the present, namely NetApp, Inc., Sunnyvale, Calif., The descriptions set forth in these patents are hereby incorporated by reference into the present application. An initial snapshot of the file system of the source storage system is created by the differential source module 122 at the point in time when the replication operation is performed. This initial snapshot of the file system is referred to as the baseline snapshot. This baseline snapshot is then handed off to the source replication engine 8A for the replication operations. Then, all the data from the source storage system is transferred to the destination storage system, where a snapshot of the destination is also taken. This results in the source and destination storage systems having identical data and identical baseline snapshots for the initial replication operation. This baseline snapshot will serve as a basis for any subsequent incremental replication operations.

After the initial replication operation, the replication operations are performed incrementally to capture modifications to the data container of the source storage system over time. These incremental replication operations involve creating additional snapshots of the data container of the source storage system, identifying changes in the data container since a previous replication operation by comparing the snapshot with a previous snapshot created during an earlier replication operation, and transferring the identified changes to the destination storage system in an unordered stream of individual data units while preserving the data object identifiers. Specifically, after the baseline snapshot of the file system or other data container is generated by the source differential module 122, subsequently, from time to time, additional snapshots of the file system are generated. At some later time, the source replication engine 8A executes another replication operation (which may be at the request of the destination replication engine 8B). To do so, the source replication engine 8A needs to be updated with the changes to the file system of the source storage system since the previous replication operation was performed to make sure all changes in the file system of the source storage system are replicated at the destination storage system. To accomplish this, the snapshot differential module 122 compares the most recent or current snapshot of the source file system to the snapshot corresponding to the previous replication operation to determine differences between the snapshots. The snapshot differential module 122 identifies any data that has been added, deleted, or modified since the previous snapshot operation, and transfers those changes to the source replication engine 8A for replication.

Embodiments described herein overcome some of the disadvantages of replication operations in prior storage systems by performing replication of the file system of the source storage system at the logical block and logical entry level. Performing replication at the logical block and logical entry level gives a storage system more flexibility and efficiency in replication operations, allowing for transferring modifications of the data container to the destination storage system in an unordered stream of individual data units. A replication operation transfers information from a source data container to the replica data container at the destination. Since the replication is performed at the logical block and logical entry level, the replication can be performed without regard to either the differences in geometry of the physical persistent storage media of the source and destination storage systems or the differences in data container format of the source and destination storage systems. For the purposes of this description, the term unordered means out of order, or not necessarily in any specified, particular, or predetermined order. The modifications or additions to the data container in the source can be transferred to the destination without having to first walk the directory trees of the source storage system to determine the directory structure. In addition, the modifications can be transferred to the destination asynchronously. This means that changes to the source storage system are not immediately reflected in the destination storage system. Rather, the transfers are performed between one or more snapshots taken of the tile system over time. At least some of the advantages of asynchronously transferring the source modifications to the destination include: 1) after the source sends down one replication operation, it doesn't have to wait for the destination to finish with that one and acknowledge it before sending the next one; and 2) the destination doesn't have to finish working on one replication operation before it starts working on the next one. Both of these contribute to increasing the overall speed of the replication operations.

In one embodiment, the data container is a file system and the replication operations include data operations, directory operations, and inode operations. In “data operations,” the transfers include 1) a block of file data, 2) the inode number of the block of data, 3) the generation number of the file, and 4) the position of the block within the file (e.g., FBN). In “directory operations,” the transfers include: 1) the inode number of the directory; 2) the generation number of the director; and 3) enough information to reconstitute an entry in that directory including the name, inode number, and generation number of the file system object the directory entry points to. Finally, in “inode operations,” the transfers include the meta-data of an inode and its inode number. An inode operation can be used to indicate that a file has been deleted, and also possibly that another file has been created at the same inode number. For example, if the data object type changes from “file” or “directory” to “unused,” there has been a deletion, and if the generation number changes, there has been a deletion and a subsequent creation. We will call the latter case a “replacement”.

To perform a replication of an entire file system, the source sends an unordered sequence of data operations, directory operations, and inode operations to the destination, which is expected to process the operations and send acknowledgments to the source. Notably, in at least certain embodiments, each directory entry of a particular directory are modified individually one at a time. This is important for scalability, since modem storage systems continue to grow in volume and capacity at a rapid pace. Scalability requires incremental updates to be really incremental modifications of large files one block at a time, modifications of large directories one entry at a time, etc. if a large directory has just one changed directory entry, for example, then it is not necessary to ship over the whole directory. As discussed above, the replication of a data container may be either an “initialization”, in which the destination data container starts from scratch with no files or directories, or it may be an “incremental update”, in which the destination data container already has some files and directories from an earlier replication operation of an earlier version of the source. In an incremental update, the source file system doesn't need to transfer every file and directory entry to the destination; rather, it only needs to transfer the incremental changes that have taken place since the earlier version was replicated.

FIG. 6A depicts an initial replication process of a file system of a source storage system at the logical block and logical entry level according to an illustrative embodiment. Process 600A begins at operation 601 by scanning the mode file of the source file system in lockstep (operation 601). In one embodiment, the inode file is scanned sequentially, where each inode in the mode file is scanned in mode file order. As discussed above, an mode file is a data structure representing a master list of file system objects, and each entry of the inode file is an inode that identifies a particular file system object within the file system. File system objects can be files, directories, and/or sub-directories of the file system inodes are arranged sequentially in the inode file, and a file system object's position in the inode file is given by its mode number. For directory entries, each entry includes the name of the file the directory entry references and the file's mode number. In addition, a directory has its own inode and inode number. Each mode includes a master location catalog for the file, directory, or other file system object, as well as various bits of information about the file system object called meta-data. The metadata includes, for example, the file system object's creation date, security information such as the file system object's owner and/or protection levels, and its size. The metadata also includes a “type” designation to identify whether the file system object is one of the following types: 1) a “file;” 2) a “directory;” 3) “unused;” or 4) “not yet known.”

Importantly, the metadata also includes the “generation number” of the file system object. As time goes by, file system object is created or deleted, and slots in the inode file are recycled. When a file system object is created, its inode is given a new generation number, which is guaranteed to be different from (e.g., larger than) the previous file system object at that inode number. If repeated accesses are made to the file system object by its inode number (e.g., from clients, applications, etc.), the generation number can be checked to avoid inadvertently accessing a different file system object after the original file system object was deleted. The metadata also includes “parent information,” which is the inode number of the file system object's parent directory. A file system object can have multiple parent directories.

At operation 603, it is determined whether all the modes in the mode file have been processed. If so, this completes process 600A. If not, control flows to operation 605 where the file system objects continue to be transferred to the destination storage system 2B as an unordered stream of individual data units without regard to the physical geometry or data organization of the destination storage system. In one embodiment, the transfers occur from the beginning to the end in a single pass through the inode file of the source storage system 2A without having to first determine the directory tree structure of the file system. This is an unordered replication operation, so the transfers can occur while any remaining mode entries are still being scanned. The mode file is scanned only once, and whenever changes to any file system object of the file system of the source storage system 2A are detected, those changes can be immediately transferred to the destination storage system 2B. It does not matter the order in which the modifications are transferred to the destination storage system 2B since the replication is being performed at the logical block and logical entry level. For example, if the changes to a file are discovered in the source mode file before changes to the directory in which the file is located are discovered, those changes may nevertheless be transferred to the destination storage system 2B.

This is allowed because the inode file of the source storage system is preserved in the replica mode file at the destination. As will be discussed further below, as long as the mode entries in each of the mode files of the source and destination storage systems 2 are matched, it does not matter what order the file system objects are transferred from the source storage system to the destination storage system. The replica mode file at the destination storage system provides the “road map” showing how to reconstruct (re-order) the file system objects once they are received at the destination storage system. Therefore, files can be transferred before the directories in which they are located, sub-directories can be transferred before the directories in which they are located, files can be transferred before their associated metadata describing the files, and file blocks of files can be transferred in any order. In addition, it is not necessary to wait for the destination to acknowledge that it has processed a previously transferred modification before the source transfers the next identified modification. That is, it is not necessaity to serialize the data flow. One transfer is not required to finish before a subsequent transfer can take place providing additional performance due to the unordered replication operations disclosed herein.

Further, since the file system is being replicated at the logical block and logical entry level, it does not matter whether the destination server has different physical storage geometry than the source storage system. For example, the source storage system can be implemented in a RAID 5 configuration, whereas the destination can be RAID 3 or RAID 7, and on on. In addition, it does not matter that the destination storage system has a different file system format than the source storage system. The logical replication operations described herein allow for replication regardless of the organization of data between the source and destination storage systems and can be done in any order as will be discussed below. This can be accomplished by preserving the i node file of the source storage system in a replica inode file at the destination storage system. This completes process 600A.

FIG. 6B depicts a process for replicating a file system of a source storage system on a destination storage system at the logical block and logical entry level according to an illustrative embodiment. Process 600B begins at operation 611 by receiving, at the destination storage system 2B, the unordered stream of individual data units transferred from the source storage system 2A. If the replication is a first initialization, the unordered stream of individual data units includes all the file system objects in the source file system. If the ‘replication is an incremental update, the unordered stream of individual data includes additions, deletions or modifications to one or more file system objects of the source storage system since a previous replication operation was performed. As discussed above, the file system Objects can be any one or more of directories, sub-directories, or files of the file system in the source storage system. The file system objects of the source storage system are then replicated at the destination storage system at a logical block and logical entry level using the unordered stream of individual data units to be described below. The replication operation is performed without regard to the differences in the organization of the data between the source storage system and the destination storage system. These differences can include differences in the geometry of the physical persistent storage of the source and destination storage systems and/or differences in the file system format of the source and destination storage systems.

Process 600B continues with operation 613 where the inode numbers assigned to the file system objects in the inode file of the source storage system are matched to the corresponding inode numbers in the replica inode file at the destination storage system. In incremental update replication operations, after the matching inode numbers are found, the generation numbers of the file system objects are compared to determine if the replication operation is an addition or modification (replacement) of the file system object at the destination storage system (operation 614). If the generation number corresponding to a file system object that has been changed in the unordered stream of individual data units matches the generation number associated with the inode entry in the replica mode file at the destination storage system, this indicates that the incremental replication operation is an “addition” of the file system object to the destination. Accordingly, the tile system object that has been changed is added to the appropriate inode entry in the replica inode file at the destination storage system so that the inode number of the inode file of the source storage system is preserved in the replica inode file of the destination storage system 2A (operation 615). If the generation number does not match the generation number associated with the inode entry in the ‘replica inode file at the destination storage system, this indicates that the replication operation is a “replacement” of the file system object at the destination. As discussed above, a deletion operation is indicated by changing the “type” designation in the file system object's metadata to “unused.”

After the inode entries are matched and the generation numbers are compared, the data associated with the file system objects is stored in unused blocks of physical persistent storage in the destination storage system (operation 617). One advantage of embodiments described herein is that the data can be stored in any unused location at the destination storage system and it does not matter where. This is because the data replication operation is at the logical block and logical entry level, and the location of the block in physical storage is irrelevant as long as the appropriate pointers in the logical file system structure are properly updated as will now be discussed. Process 600B continues with operation 619, where the buffer tree representing the logical block structure of the file system at the destination storage system is updated to point to the data of the one or more file system objects stored in the unused block of physical persistent storage of the destination storage system. In one embodiment, this includes updating the lowest-level indirect block in the buffer tree with a pointer to the data in the file system objects and storing the lowest-level indirect block to a different unused block of data in the physical persistent storage of the destination storage system. This process is repeated all the way up the buffer tree until the highest-level indirect block is reached and all the pointers in the buffer tree appropriately reference the newly stored blocks of data representing the file system objects in physical persistent storage of the destination storage system. This process is called “splicing” a block of data into the buffer tree. Process 600B continues with operation 621 where logical block pointers in the inode file are assigned to the highest-level indirect block referencing the data of the file system objects. This is the logical block level to physical block level mapping that enables the file system of the source storage system 2A to be replicated out-of-order in the destination storage system 2B. This completes process 600B.

FIG. 6C depicts an incremental replication process of a file system in a source storage system at the logical block and logical entry level according to an illustrative embodiment. Process 600C begins at operation 631 by creating a snapshot of the file system of the source storage system at a point in time. In one embodiment, this is performed by a snapshot differential module 122 in the source storage system 2A. Once the snapshot is created, it can then be compared to a previous snapshot to determine modifications and additions to the file system of the source storage system since the previous replication operation was performed. Process 600C continues with scanning the mode files of the current snapshot and a previous snapshot of the source file system in lockstep (operation 633). In one embodiment, the inode file is scanned sequentially, where each inode in the inode file is scanned in inode file order. At operation 634, it is determined whether all the inodes in the inode file have been processed. If so, this completes process 600C. If not, control flows to operation 635 where each inode entry in the current snapshot is compared to the corresponding mode entry in the inode file of the previous snapshot to identify changes to the file system since the previous snapshot was taken,

At operation 637, the modifications to the file system of the source storage system since the previous snapshot are identified based on results of the comparison in operation 635. These modifications are replicated in the destination storage system at the logical block and logical entry level. The modifications can then be transferred to the destination storage system as an unordered stream of individual data units without regard to the data organization of the destination storage system (operation 639). As discussed above, the logical replication operations described herein allow for replication regardless of the organization of data between the source and destination storage systems and can be done in any order. At operation 639, the data representing the identified modifications in the one or more file system objects of the source file system are transferred to the destination storage system in any order. In one embodiment, the transfers occur in a single pass through the inode file without having to first determine the directory tree structure of the file system. This completes process 600C.

In the case where the data objects are files, the logical block pointers assigned to the highest-level indirect blocks include the FBNs in the inode file. The FBNs are assigned to their respective highest-level indirect block in the buffer tree of the file referencing the appropriate modified file system objects stored in the physical persistent storage medium of the destination storage system 2A. This is shown in FIG. 7A, which depicts replicating a data file block at the logical block level according to an illustrative embodiment inode file 741A is the inode file at the source storage system 2A that is replicated in replica inode file 741B at the destination storage system 213. Each inode entry represents a file (or a directory to be discussed below) and is the root of the buffer tree for that file. In FIG. 7A, node file 741A includes a file at mode number 722 with file blocks FBN 0 through FBN 2. Likewise, replica mode file 741B includes the corresponding replicated file at inode number 722 with file blocks FBN 0 through FBN2, in the illustrated embodiment, the file blocks are replicated by transferring an unordered stream of individual data units 733 from the inode file 741A of the source storage system 2A to the destination storage system 2B.

When the file system object being replicated is a file, in one embodiment a “data operation” is performed. In a data operation, the unordered stream of individual data units 733 includes: 1) the FBN of the file block being replicated; 2) the corresponding inode number for the data block at that FBN; 3) the block of data corresponding to that FBN; and 4) the generation number of the file. In the case of FBN 0, the unordered stream 733 includes FBN 0, mode number 722, the block of data corresponding to FBN 0; and the generation number of the file. When the unordered stream 733 reaches the destination storage system 2B, FBN 0 is assigned to the corresponding mode number 722 in the replica mode file 741B so that the mode number of FBN 0 in the source storage system 2A is preserved in the replica mode file 741B at the destination storage server 2B. The block of data corresponding to FBN 0 is then stored at an unused block of data in the physical persistent storage medium 745 of the destination storage server 2B. In the illustrated embodiment, the block of data is stored at direct block L0. Then, the data at direct block L0 is spliced into the buffer tree. This includes updating at least one indirect block (in this case L1) in the buffer tree to point to the data of direct block L0. In one embodiment, this is accomplished by storing the indirect block containing the pointer to direct block L0 to a different unused block of data in the physical persistent storage medium 745 of the destination storage server 2B. As shown, newly stored PVBN/VVBN block L1 references direct block L0,

After the direct block L0 is spliced into the buffer tree, FBN 0 is assigned to the highest-level indirect block of the buffer tree using a logical pointer 735. In this case, logical pointer 735 references PVBN/VVBN block L1, since this is the only indirect block in the illustrated embodiment. However, as discussed above, alternate embodiments can include any number of indirect blocks in the buffer tree, the highest of which is assigned to FBN 0 using logical pointer 735.

FIG. 7B depicts replicating a directory at the logical entry level according to an illustrative embodiment inode file 741A is the inode file at the source storage system 2A that is replicated in replica inode file 741B at the destination storage system 2B. Inode file 741A includes directory 0 located at inode number 719 and entries A, B and C of directory 0. Likewise, replica inode file 741B at the destination storage server 2B includes directory 0 located at inode number 719 and entries A, B and C of directory 0. In the illustrated embodiment, directory 0 is replicated by transferring an unordered stream of individual data units 733 from the inode file 741A of the source storage system 2A to the destination storage system 2B.

When the file system object being replicated is a directory or subdirectory, in one embodiment a “directory operation” is performed. In a directory operation, the unordered stream of individual data units 733 includes the directory/subdirectory entry that has changed in the source file system including: 1) the inode number of the directory (#719 in the illustrated embodiment); 2) the generation number of the directory; 3) the pointer to the file system object referenced by the directory/subdirectory entry (logical pointer to INODE #722 in this case); 4) the mode number of the file system object referenced by the directory/subdirectory entry (INODE #722 in this case); and 5) the generation number of the refrenced file system object. Each directory entry includes the name of the file system object referenced by the directory/subdirectory entry. This is shown as logical to INODE #722. In one embodiment, when the unordered stream 733 reaches the destination storage system 2B, directory 0 is assigned to the inode number in the replica inode file 741B corresponding to the inode number 719 so that the inode number of directory 0 in the source storage system 2A is preserved in the replica inode file 741B at the destination storage server 2B. The directory entry A of directory 0 is then stored at an unused block of data in the physical persistent storage medium 745 of the destination storage server 2B. As discussed above, this directory entry includes the name, inode number and generation number of the file system object referenced by the entry.

When the generation number of the directory matches the generation number at the corresponding inode number of the replica inode file 741B, the replication operation is adding a directory entry to the directory. In such a case, the directory entry is added to the mode file 741A of the source storage system, and, in a subsequent replication operation, the directory entry is transferred to the destination storage system 2B. FIG. 8A depicts adding a new directory entry during a replication operation according to an illustrativ embodiment, lo FIG. 8A, new entry C has been stored to an unused block of data in the physical persistent storage medium 845 at the destination storage system 2B. After the new entry is stored, the buffer tree corresponding to directory 0 is updated to reference the new directory entry C. This is accomplished by storing a new directory 0 to a different unused block of data in the physical persistent storage medium 845 with updated pointers including a pointer to new entry C.

In the case where a directory entry was deleted since a previous replication of the file system of the source storage system 2A, the directory entry is removed from the inode file 741A of the source storage system, and, in a subsequent replication operation, the name of the directory entry that was deleted is transferred to the destination storage system 2B in the unordered stream 735. FIG. 8B depicts deleting a directory entry during a replication operation according to an illustrative embodiment. In FIG. 8B, entry B has been deleted. After entry B is deleted, the buffer tree corresponding to directory 0 is updated. This is accomplished by storing a new directory 0 to an unused block of data in the physical storage medium 845 of the destination storage system 2B. In this case; however, the new directory 0 does not reference the deleted entry B. Old directory 0 included entries A, B and C, respectively. New directory 0 includes entries A and C, respectively, and there is no pointer referencing deleted entry B. Note that deleted entry B is not “deleted” from the physical medium 845; rather, entry B is de-referenced meaning that for all practical purposes, entry B is deleted even though there is no operation to modify the data block in physical medium 845.

in the case where a directory entry has been modified since a previous replication of the file system of the source storage system 2A, in a subsequent replication operation, the name of the directory entry that was modified is transferred to the destination storage system 2B in the unordered stream 735. FIG. 8C depicts modifying a directory entry during a replication operation according to an illustrative embodiment. In FIG, 8C, entry A has been modified. After entry A is modified, the buffer tree corresponding to directory 0 is updated in the destination storage medium 845. This is accomplished by storing modified entry A to any unused block of data in physical medium 845 of destination storage system 2B and storing a new directory 0 to a different unused block of data in the physical storage medium 845 with updated pointers including a pointer to modified entry A. Referring to FIG. 8A, before modified entry A was stored in physical medium 845, old directory 0 included entries A, B and C, respectively. After modified entry A is stored in physical medium 845, new directory 0 is stored at the different unused block of data in the physical medium 845 with pointers referencing entries A (modified), B, and C respectively.

The destination storage system 2B is prepared to handle operations in any order. Consider a simple example in which an update replication is to be performed, and the only change to the source since the previous update was that a new file, F, was created in an existing directory D, with some initial data. Three operations would be transferred to the destination including: l) a directory operation describing the addition of a new entry in D; 2) an inode operation describing the initialization of Fs inode; and 3) a data operation describing the initial data in F. These operations may be sent from the source to the destination in any order. The following paragraphs describe the processing done by the destination for different cases of ordering of operations using the example cited above of file F and directory D.

Case (1): when the “directory operation” is processed first, Fs inode is initialized creating the entry in D pointing to F. The resulting mode has correct parent and generation number, but its “type” is designated “not yet known.” Case (2): when the “data operation” is processed first specifying a block of Fs data, again Ps inode is initialized. The resulting mode has the correct generation number, but parent information is designated “not yet known.” Case (3): when the “mode operation” is processed first, the parent information is designated “not yet known” because this information is not sent from the source for the mode operation. This information can only be fully known after the “directory operation” is processed since the directory operation results in fully specifying a portion of the parent information (which is the position of the name in the parent directory) in cases (1) and (2), by the time the mode operation is processed, a (partially specified) mode is already present at the given mode number. The destination then determines whether the current mode operation represents a replacement or (as in this example) a creation. The determination is made based on the inode's generation number; and, if it doesn't match the generation number in the operation, a replacement is occurring (note a replacement cannot occur in this example because it is a replica creation).

Now consider a second slightly different example, in which two (2) changes are made at the source file system since the previous update: in directory D, first file F was deleted; then a new file was created with the same name F, and using the old file's mode number. Again, for the replication, three operations would be transferred to the destination: 1) a “directory operation” describing the modification of the entry in D for a file named F; 2) an “inode operation” describing the initialization of Fs new mode; 3) and a “data operation” describing the initial data in F's new file. An important aspect of file replacement (as well as simple deletion) is that the old file's data is freed (recycled). That is, if the old file has no more parents, it can no longer be accessed by clients, and its blocks of data can be re-used for files that have new data. The process of recycling blocks in this fashion is begun whenever the destination learns that a replacement is to be done in the present example of replacement, whichever of the three operations is processed first will trigger the recycling of data blocks, as all three operations specify the new generation number of the new file F, and the destination can compare the new generation number with the old generation number in the inode, which will be that of the old file. The new file has the same name, “F”, as the old file. Thus, a single directory operation is transferred to the destination indicating that the directory entry is modified. If the new file had a different name, say “G”, then two directory operations would be transferred: one to delete the entry for F, and the other to create the entry for G. These operations can be received and processed in either order.

Now consider a third example, in which two changes were made at the source file system since the previous update operation: in directory D, a first subdirectory SD was created; then in subdirectory SD, a file F was created, with some data. For the subsequent replication, the following five operations are performed: 1) an inode operation creating SD; 2) an inode operation creating F; 3) a directory operation creating an entry in D pointing to SD; 4) a directory operation creating an entry in SD for F; and 5) a data operation giving a block of data to F. These five operations could happen in any order. 11 the directory operation creating an entry in SD is processed first, then not only is Fs inode initialized, but also must SD's inode, both with incomplete information about meta-data (since neither inode operation has been processed yet).

Now consider an example that follows up the previous example. Suppose that after the replication, file P is deleted, and then subdirectory SD, which is now empty, is also deleted, and then there is another replication. Three operations will be performed including: 1) an inode operation deleting SD; 2) an i node operation deleting F; and 3) directory operation deleting the entry of D pointing to SD. In one embodiment, no operation is transferred to recycle F's data blocks since the destination does this automatically when processing the inode operation deleting F. Similarly, no operation is transferred to delete the entry of SD pointing to F since the destination does this automatically when processing the inode operation deleting SD. The three operations can be processed in any order. If the inode operation deleting SD is processed first, then after it has been processed, inode has invalid information about that file's parent. But this condition is only temporary, as the mode operation deleting F will eventually be processed. The above examples illustrate the range of tasks that the destination can perform to implement the different types of operations, and to ensure that operations can be processed in any order.

In at least certain embodiments, the above described operations are idempotent. Idempotence refers to operations where multiple instances of the operation do not change the result. That is, if an operation is performed twice or more, the same result will be achieved. Idempotence is desirable when a replication is interrupted. For example, the source and the destination may lose contact with each other (e.g., due to network outage or due to outage of either the source or the destination). After the outage, the source and destination will try to resume the replication. To do this, operations are designed so that they can be replayed to achieve the same result. In this context, if the unordered stream of individual data units is somehow interrupted by a system crash or other power failure of the source storage system, the data can be replayed from the last point (e.g., a checkpoint) where the last good data is known to have been replicated. When the data is replayed, there may be some modifications of file system Objects that get transferred to the destination storage system twice (or more times). If the destination storage system 2B is designed for idempotent operations, the same result will be achieved even though the same modifications were transferred multiple times. Thus, the replica file system in the destination storage system 29 will remain free from corrupt data.

However, it may not be practically possible to determine exactly how far the destination had progressed before the interruption; instead, an approximate determination is made, such that when the replication is resumed, some operations are re-done. In one embodiment, to ensure idempotence of directory operations, destination storage system 29 specifically checks for repeated operations. In creating an entry in directory D to point to file F, first the destination checks whether an entry by the same name already exists, hi this embodiment, anew entry will not be created if there is an existing one (and in addition the operation is allowed to succeed—i.e., the operation reports success even though it didn't do anything). In deleting an entry in directory D for file F, first the destination checks whether the entry still exists, and does nothing if the entry no longer exists (and in addition, the operation is allowed to succeed i.e., the operation reports success even though it didn't do anything).

Accordingly, in the foregoing a method and apparatus for replicating a file system at the logical block and logical entry level using an unordered stream of individual data units is described. The foregoing description has been directed to specific embodiments of this invention. It will be apparent to persons of skill in the art, however, that other variations and modifications may be made to the described embodiments, while maintaining some or all of their advantages. For example, it will be apparent from this description that aspects of the present invention may be embodied, at least in part, in software, hardware, firmware, or in combination thereof. The techniques described herein may be carried out in a computer system or other data processing system in response to its processor, such as a microprocessor, executing sequences of instructions contained in a memory, such as a ROM, volatile RAM, non-volatile memory, cache memory, or other remote storage device memory. In various embodiments, hardwired circuitry may be used combination with software instructions to implement this present description. Thus, the techniques are not limited to any specific combination of hardware circuitry and/or software, or to any particular source for the instructions executed by a data processing system

Additionally, the apparatuses described herein may be specially constructed for the required purposes, or they may comprise a general purpose computer selectively activated or configured by a computer program stored in a memory of the computer. Such a computer program may be stored in a computer-readable medium. A computer-readable medium can be used to store software instructions, which when executed by a data processing system, causes the system to perform the various methods of this description. A computer-readable medium may include any mechanism that provides information in a form accessible by a machine (e.g., a computer, network device, personal digital assistant, or any device with a set of one or more processors). For example, a computer-readable medium may include any type of disk including floppy disks, hard drive disks (FIDDs), solid-state devices (SSDs), optical disks, CD-ROMs, and magnetic-optical disks, ROMs, RAMs, EPROMs, EEPROMs, other flash memory, magnetic or optical cards, or any type of media suitable for storing instructions in an electronic format.

Throughout the fbregoing description, for the purposes of explanation, numerous specific details were set forth in order to provide a thorough understanding of the invention. It will be apparent, however, to one skilled in the art that the invention may be practiced without some of these specific details. In addition, embodiments of the invention may include various operations as set forth above, or fewer operations or more operations, or operations in an order which is different from the order described herein. Accordingly, the scope and spirit of the invention should be judged in terms of the claims which follow as well as the legal equivalents thereof. 

1.-31. (canceled)
 32. A method of replicating data in a file system, comprising: creating a current point-in-time image of a file system stored within a source storage server, the source file system configured to store multiple data objects, each object having assigned to it a corresponding data object identifier; scanning data objects within the source file system to identify changes in the source file system that occurred after an earlier replication operation was performed, by comparing the current point-in-time image with a previous point-in-time image corresponding to the earlier replication operation, the changes in the source file system including updates to a data block of a file having both modified and unmodified data blocks and a generation number of the file; and transferring, in an unordered stream to a destination storage server, the changes in the source file system as multiple individual data units while preserving corresponding file system object identifiers to replicate the source file system at the destination storage server; wherein the transferring includes, for the file, transferring only the modified data blocks, and for a directory, transferring only modified directory entries.
 33. The method of claim 32, wherein the transferring comprises: transferring the changes in the source file system as multiple individual data units in the unordered stream to the destination storage server without regard to a hierarchical structure of the source file system.
 34. The method of claim 32, wherein the transferring comprises: transferring the changes in the source file system as multiple individual data units in the unordered stream to the destination storage server without regard to differences in geometry of physical persistent storage of the source and destination storage servers and without regard to differences in file system format of the source and destination storage servers.
 35. The method of claim 32, further comprising: scanning file system objects within the source file system by examining one or more inode entries in an inode file of the source file system from beginning to end in a single pass through the inode file of the source file system, wherein when the inode is a directory, scanning one or more individual directory entries; and transferring the file system objects to the destination storage server without first determining where the file system objects are located in a directory tree of the source file system.
 36. The method of claim 34, wherein at least one of the file system object identifiers is an inode number of an inode entry in an inode file of the source storage server.
 37. The method of claim 36, wherein the inode file is a data structure representing a master list of source file system objects and each inode entry of the inode file identifies a particular file system object within the source file system.
 38. The method of claim 37, further comprising: initiating a data operation when the file system object to be replicated is a file; and initiating a directory operation when the file system object to be replicated is a directory or subdirectory.
 39. The method of claim 38, wherein for a data operation the unordered stream includes: a file block number of the data block being replicated; a corresponding inode number for the data block corresponding to the file block number; a block of data corresponding to the file block number; and the generation number of the file.
 40. The method of claim 38, wherein for a directory operation the unordered stream includes: an inode number of a directory corresponding to a directory entry being replicated; a generation number of the directory; a name of the file system object referenced by the directory entry; an inode number of the file system object referenced by the directory entry; and a generation number of the file system object referenced by the directory entry.
 41. The method of claim 38, further comprising: transferring a file of the source file system to the destination storage server before transferring a directory in which the file is located; transferring data blocks of a file of the source file system to the destination storage server before transferring metadata describing the file; transferring individual directory entries out of order; or transferring individual data blocks of a file out of order.
 42. A computer-readable storage medium storing computer-executable instructions, comprising: instructions for receiving, in an unordered stream from a source storage server at a destination storage server, multiple file system objects, the file system objects in the unordered stream having changes that occurred in a file system of the source storage server after a previous replication operation was performed, wherein each of the file system objects includes a corresponding file system object identifier, the changes in the file system of the source storage server including updates to a directory entry of a directory having modified and unmodified directory entries and a generation number; wherein the receiving includes, for a file, receiving only modified data blocks, and for the directory, receiving only the modified directory entries and the generation number; instructions for replicating the file system objects at the destination storage server using the file system object identifiers; and instructions for creating a current point-in-time image of a replicated file system of the destination storage server once the file system objects are replicated at the destination so that corresponding point-in-time images of the source and destination storage servers are identical.
 43. The storage medium of claim 42, wherein each of the file system object identifiers is an inode number of an inode entry in an inode file of the source storage server, and wherein the source inode file is a data structure representing a master list of source file system objects and each inode entry identifies a particular file system object within the source file system.
 44. The storage medium of claim 43, further comprising: instructions for matching the inode number of the source file system object in the source inode file with a corresponding inode number in a replicated inode file at the destination storage server; and instructions for adding the file system object to an inode entry in the replicated inode file at the destination storage server so that the inode number of the source inode file is preserved in the replicated inode file of the destination storage server.
 45. The storage medium of claim 44, further comprising: instructions for storing data associated with each file system object to an unused block of data in physical persistent storage of the destination storage server; and instructions for updating a buffer tree representing a logical block structure of the destination file system to reference the data of each file system object, wherein the buffer tree includes a hierarchical metadata structure comprising pointers to logical blocks of data in the destination file system.
 46. The storage medium of claim 45, wherein the instructions for updating the buffer tree comprises: instructions for updating an indirect block in the buffer tree to include a pointer to the data of each file system object; instructions for storing each indirect block to a different unused block of data in physical persistent storage of the destination storage server; and instructions for repeating the updating and storing until all pointers to each data of the file system object in the destination buffer tree have been updated.
 47. The storage medium of claim 46, further comprising: instructions for assigning the file block number to a highest-level indirect block in the destination buffer tree referencing the data of the file system object.
 48. A computing device for replicating data in a file system, comprising: a processor; an input interface configured to receive, in a stream at a destination storage server, changes in a source file system as multiple individual data units while preserving corresponding file system object identifiers to replicate the source file system at the destination storage server, wherein an ordering of the individual data units within the stream is independent of a hierarchical structure of the source file system; and a memory including instructions, when executed by the processor, to perform a process including steps of: determining whether a data unit within the stream represents an addition operation to a file system object or a replacement operation to the file system object based on a generation number received along with the data unit; storing data of the data unit in unused blocks of a physical persistent storage in the destination storage server; and updating metadata of the file system object of the source file system.
 49. The computing device of claim 48, wherein the determining step comprises: if the generation number received along with the data unit matches a generation number associated with a file system object; determining that the data unit represents an addition operation to the file system object; or if the generation number received along with the data unit does not match the generation number associated with the file system object; determining that the data unit represents a replacement operation to the file system object.
 50. The computing device of claim 48, wherein the updating step comprises: updating a buffer tree representing a logical block structure of at least a file system object at the destination storage server with one or more pointers to the data of the file system object stored in the unused blocks of the physical persistent storage.
 51. The computing device of claim 48, wherein the process further comprises steps of: determining that the changes include a deletion operation indicated by a designation of a file system object as unused; and deleting the file system object from the source file system. 